﻿using System;
using System.Diagnostics.Contracts;
using Adalbertus.BudgetPlanner.Domain;
using Adalbertus.BudgetPlanner.Domain.Repositories;

namespace Adalbertus.BudgetPlanner.Services.CodeContracts
{
    [ContractClassFor(typeof(IIncomeService))]
    public class IIncomeServiceContract : BaseService<Income>, IIncomeService
    {
        public IIncomeServiceContract(IRepositoryFactory repositoryFactory, IUnitOfWorkProvider unitOfWorkProvider) : base(repositoryFactory, unitOfWorkProvider)
        {
        }

        public Income Create(string name)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(name));
            Contract.Ensures(Contract.Result<Income>() != null);
            throw new NotImplementedException();
        }

        public IncomeEntry CreateEntry(Income income, decimal value, DateTime date)
        {
            Contract.Requires<ArgumentNullException>(income != null);
            Contract.Requires(value >= 0);
            Contract.Ensures(Contract.Result<IncomeEntry>() != null);
            Contract.Ensures(Contract.Result<IncomeEntry>().Value == value);
            Contract.Ensures(Contract.Result<IncomeEntry>().Date == date);
            Contract.Ensures(Contract.Result<IncomeEntry>().Income == income);
            
            throw new NotImplementedException();
        }

        public void RemoveEntry(IncomeEntry entry)
        {
            Contract.Requires<ArgumentNullException>(entry != null);
            throw new NotImplementedException();
        }
    }
}
